//
// Created by 张兮兮 on 2025/3/13.
//

#ifndef TEMP_WORKER_H
#define TEMP_WORKER_H

#include <QObject>
#include <QThread>
#include <QLocalSocket>
#include <QProcess>
#include <QImage>

class Worker : public QObject {
Q_OBJECT
public:
    explicit Worker(QObject *parent = nullptr);

    ~Worker();



public slots:
    void init();
    void processImage(const QImage &image);  // 处理图片
    void stop();  // 停止线程并释放资源
    void handleProcessOutput();


signals:
    void workerStopped();
    void resultReady(const QString &result);  // 处理完成的信号

private:
    QLocalSocket *socket = nullptr;
    QProcess *process = nullptr;
    bool running = false;
    QString socketPath = "";
};


#endif //TEMP_WORKER_H
